import { axios } from '@/utils/request'
import store from '@/store'
const api = {
  homeWork: '/school/homeworks',
  teacherIndex: 'school/evaluates/teacher-index',
  examsList: '/school/exams',
  growthArchivesList: '/school/growth-archives',
  createAarchives: '/school/growth-archives/create'
}

export default api

// =========================================家校互动=======================================================
export function homeworkList(parameter) {
  //获取作业列表
  return axios({
    url: api.homeWork,
    method: 'post',
    data: parameter
  })
}
export function clockincreate(parameter) {
  //创建打卡作业
  return axios({
    url: '/school/homeworks/clock-in-create',
    method: 'post',
    data: parameter
  })
}


export function readStudent(id) {
  //作业阅读学员
  return axios({
    url: '/school/homeworks/' + id + '/read-student',
    method: 'post'
    // data: parameter
  })
}

// =========================================评价=======================================================

export function teacherIndex(parameter) {
  //评价学员列表
  return axios({
    url: api.teacherIndex,
    method: 'post',
    data: parameter
  })
}
export function stuIndex(parameter) {
  //评价老师列表
  return axios({
    url: '/school/evaluates/stu-index',
    method: 'post',
    data: parameter
  })
}

export function teacherRecord(parameter) {
  //评价学员记录
  return axios({
    url: '/school/evaluates/teacher-record',
    method: 'post',
    data: parameter
  })
}

export function teacherShow(id) {
  //课次评价详情
  return axios({
    url: '/school/evaluates/' + id + '/teacher-show',
    method: 'post'
  })
}

export function evaluateStuShow(data, id) {
  //评价教师详情
  return axios({
    url: '/school/evaluates/' + id + '/stu-show',
    method: 'post',
    data: data
  })
}

export function teacherRecordshow(id) {
  //评论学员记录详情
  return axios({
    url: '/school/evaluates/' + id + '/teacher-record-show',
    method: 'post'
  })
}

export function scoreCreate(data) {
  //添加评分维度
  return axios({
    url: '/school/evaluate-score-dims/create',
    method: 'post',
    data: data
  })
}
export function scoreDelete(id) {
  //评分维度删除
  return axios({
    url: '/school/evaluate-score-dims/' + id + '/delete',
    method: 'post'
  })
}

export function evaluateDcoreDims() {
  //评分维度列表
  return axios({
    url: '/school/evaluate-score-dims',
    method: 'post'
  })
}

export function evaluatesInfo(data) {
  //评论详情
  return axios({
    url: '/school/evaluates/info',
    method: 'post',
    data: data
  })
}

export function evaluateScoreList(data) {
  //互动评论
  return axios({
    url: '/school/evaluates/comment',
    method: 'post',
    data: data
  })
}

// =========================================成绩=======================================================

export function examsList(data) {
  //成绩列表
  return axios({
    url: api.examsList,
    method: 'post',
    data: data
  })
}

export function examsCreate(data) {
  //成绩新增
  return axios({
    url: '/school/exams/create',
    method: 'post',
    data: data
  })
}

export function examsUpdate(data, id) {
  //成绩编辑
  return axios({
    url: '/school/exams/' + id +'/update',
    method: 'post',
    data: data
  })
}
//编辑删除
export function examsDel(id) {
  //成绩编辑
  return axios({
    url: 'school/exams/'+id+'/delete-student',
    method: 'post',
  })
}

export function getExams(id) {
  //成绩详情
  return axios({
    url: '/school/exams/' + id,
    method: 'post'
  })
}
export function examsdelete(id) {
  //删除成绩
  return axios({
    url: '/school/exams/' + id + '/delete',
    method: 'post'
  })
}

export function examsStudentList(id) {
  //成绩学员阅读状态列表
  return axios({
    url: '/school/exams/' + id + '/student-list',
    method: 'post'
  })
}
export function subjectsList(data) {
  //获取科目
  return axios({
    url: '/school/subjects',
    method: 'post',
    data: data
  })
}
export function subjectsCreate(data) {
  //添加科目
  return axios({
    url: '/school/subjects/create',
    method: 'post',
    data: data
  })
}

export function subjectsDelete(data) {
  //删除科目
  return axios({
    url: '/school/subjects/batch-delete',
    method: 'post',
    data: data
  })
}
export function subjectsUpdate(data, id) {
  //编辑科目
  return axios({
    url: '/school/subjects/' + id + '/update',
    method: 'post',
    data: data
  })
}
// =========================================档案=======================================================

export function growthArchivesList(parameter) {
  //获取档案列表
  return axios({
    url: api.growthArchivesList,
    method: 'post',
    data: parameter
  })
}

export function createAarchives(parameter) {
  //创建档案
  return axios({
    url: api.createAarchives,
    method: 'post',
    data: parameter
  })
}
export function archivesDel(id) {
  //删除成长档案
  return axios({
    url: '/school/growth-archives/' + id + '/delete',
    method: 'post'
  })
}

export function uploadPic(params) {
  //上传图片
  params.append('school_id',store.state.user.school)
  return axios({
    url: '/school/images/upload',
    method: 'post',
    data: params
  })
}
// =========================================点名=======================================================

export function callRecords(parameter) {
  //点名列表
  return axios({
    url: '/school/call-records',
    method: 'post',
    data: parameter
  })
}
export function editVerifyClassHour(params, id) {
  //修改点名列表核实课时
  return axios({
    url: '/school/call-records/' + id + '/edit-verify-class-hour',
    method: 'post',
    data: params
  })
}
export function editClassTime(params, id) {
  //修改点名列表上课时间
  return axios({
    url: '/school/call-records/' + id + '/edit-class-time',
    method: 'post',
    data: params
  })
}

export function callRecordsDelete(id) {
  //删除点名列表
  return axios({
    url: '/school/call-records/' + id + '/delete',
    method: 'post'
  })
}

export function callRecordsStudentList(data, id) {
  //实到人数列表
  return axios({
    url: '/school/call-records/' + id + '/student-list',
    method: 'post',
    data: data
  })
}

export function callRecordseEditType(data, id) {
  //实到人数列表
  return axios({
    url: '/school/call-records/' + id + '/edit-type',
    method: 'post',
    data: data
  })
}

export function editOrderInfo(data, id) {
  //\修改点名学生数据
  return axios({
    url: '/school/call-records/' + id + '/edit-remarks',
    method: 'post',
    data: data
  })
}
export function orderNameExcelOut(params) {
  let str = '?'
  for(let i in params){
    if(params[i]){
      str=str+`${i}=${params[i]}&`
    }
  }
  let data = str.substr(0,str.length-1)
  return axios({
    url: '/school/call-records/export' + data,
    method: 'get',
    // responseType: 'blob'
  })
}

export function orderNameExcelOutByClass(params) {
  let str = '?'
  for(let i in params){
    if(params[i]){
      str=str+`${i}=${params[i]}&`
    }
  }
  let data = str.substr(0,str.length-1)
  return axios({
    url: '/school/call-records/class-export' + data,
    method: 'get',
  })
}